<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>新吴社区学习中心 | 搜索</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Cache-Control" content="no-transform">
<link href="/courseware/css/bootstrap.css" rel="stylesheet">
<link href="/courseware/css/main.css" rel="stylesheet" type="text/css">
<link href="/courseware/css/index.css" rel="stylesheet" type="text/css">
<link href="/courseware/css/detail.css" rel="stylesheet" type="text/css">
<link href="/courseware/css/user.css" rel="stylesheet" type="text/css">
<link href="/courseware/css/login.css" rel="stylesheet" type="text/css">
<script>
    var rootUrl = '';
</script>
    <link rel="stylesheet" type="text/css" href="/courseware/css/center.css" />
	<link rel="stylesheet" type="text/css" href="/courseware/css/icono.min.css" />
</head>
<body>
	<div class="search">
		<div class="content">
			<header class="header">
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <div class="row">
                <div class="hidden-xs hidden-sm col-md-3 col-lg-3">
                    <div class="navbar-header navbar-left">
                        <a class="navbar-brand-mc" href="/courseware">
                            <p>新吴社区学习中心</p>
                        </a>
                    </div>
                </div>
                <div class="hidden-xs visible-sm-block col-sm-7">
                    <div class="navbar-header navbar-left">
                        <a class="navbar-brand-mc" href="/courseware">
                            <p style="font-size: 1.2rem;">新吴社区学习中心</p>
                        </a>
                    </div>
                </div>
                <div class="visible-xs-block col-xs-8">
                    <div class="navbar-header navbar-left">
                        <a class="navbar-brand-mc" href="/courseware">
                            <p style="font-size: 1.1rem;">新吴社区学习中心</p>
                        </a>
                    </div>
                </div>
                <div class="hidden-xs hidden-sm col-md-4 col-lg-5">
                    
                </div>
                <div class="hidden-xs col-sm-5 col-md-5 col-lg-4">
                    <div id="navbar" class="navbar-collapse collapse">
                        <ul class="nav navbar-nav pull-right">
                            <li id="nav-index" class="active"><a href="/courseware">首页</a></li>
                            <li><a href="/courseware/channels/4.html">课程</a></li>
                            <li class="nav-user"><a href="#"></a></li>
                            <li class="nav-logout"><a class="btn-logout" href="">退出</a></li>
                            <li class="nav-login"><a href="/courseware/login.html">登录</a></li>
                        </ul>
                    </div>
                </div>

                <!--搜索-->
                <div class="visible-xs-block col-xs-2" style="padding-right: 0px;">
                    <div class="nav nav-hamburger pull-right">
                        <a href="search.html"><span class="glyphicon glyphicon-search"></span></a>
                    </div>
                </div>

                <div class="visible-xs-block col-xs-2">
                    <div class="nav nav-hamburger pull-right">
                        <a href="#ham" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span></a>
                        <ul class="dropdown-menu pull-right">
                            <li><a href="/courseware">首页</a></li>
                            <li><a href="/courseware/channels/5.html">父母课堂</a></li>
                            <li><a href="/courseware/channels/6.html">核心价值观</a></li>
                            <li><a href="/courseware/channels/7.html">老年人</a></li>
                            <li><a href="/courseware/channels/8.html">乐活100</a></li>
                            <li><a href="/courseware/channels/9.html">新市民</a></li>
                            <li class="nav-user"><a href="#"></a></li>
                            <li class="nav-logout"><a class="btn-logout" href="/courseware/search.html">退出</a></li>
                            <li class="nav-login"><a href="/courseware/login.html">登录</a></li>
                                
                        </ul>
                    </div>

                </div>

            </div>
        </div>
    </nav>
</header>
			<div class="wrapper">
				<div class="container">
					<div class="row">
						<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
							<form>
                                <div class="form-group">
                                    <input type="text" class="form-control" id="txtSearch" placeholder="请输入课程名称...">
                                </div>
                                <div class="form-group">
                                    <button class="btn btn-lg btn-primary btn-block" type="button" id="btnSearch">搜索</button>
                                </div>
                            </form>
						</div>
					</div>
                    <div class="row">
                        <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
                            <ul id="results"></ul>
                            <div class="message"></div>
                        </div>
                    </div>
				</div>
			</div>
		</div>
	</div>

    <div class="bottom-bar">
	<ul>
		<li id="itemHome"><a href="/courseware/">首页</a></li>
		<li id="itemAllCourseware"><a href="/courseware/channels/4.html">全部课程</a></li>
		<li id="itemStudyCharts"><a href="/courseware/index.html#sbStudyCharts">排行榜</a></li>
		<li id="itemLogin" class="hidden"><a href="/courseware/login.html">登录</a></li>
		<li id="itemMyProfile"><a href="/courseware/profile.html">我的</a></li>
	</ul>
</div>
	<script src="/courseware/js/jquery.js"></script>
<script type="text/javascript">
	if(window.__wxjs_environment === 'miniprogram'){
        $('.header').hide();
        $('.home .content, .container .content').css('margin-top', '15px');
    };
</script>
<script src="/courseware/js/html5shiv.js"></script>
<script src="/courseware/js/respond.js"></script>

<script src="/courseware/js/jquery.cookie.js"></script>
<script src="/courseware/js/axios-0.17.1.min.js"></script>
<script src="/courseware/js/bootstrap.js"></script>
<script src="/courseware/js/header.js"></script>
	<script>
		$("#nav-index").removeClass('active');
		$("#nav-login").addClass('active');

		$(document).ready(function(){

            var instance = axios.create({
              headers: {'X-SS-API-KEY': '8a0471e9-c527-4d57-99a1-6daec32bb629'}
            });

            $("#btnSearch").click(function(){

                var _query = $("#txtSearch").val();
                instance.get('/eduonline/api/coursewares/search?query=' + _query)
                    .then(function(response){
                        $("#results").empty();
                        $(".message").empty();

                        if(response.data.length > 0){
                            $(response.data).each(function(index, item){
                                $("#results").append("<li><div class=\"h_thumbnail\" style=\"background-image: url(\'" + "/courseware" + item.imageUrl + "\')\"></div><a href=\"/courseware/contents/" + item.channelId + "/" + item.id + ".html\">" + item.title + "</a></li>");
                            });
                        }else{
                            $(".message").html("对不起,没有找到符合条件的结果");
                        }
                        
                    }).catch(function (error){
                        console.log(error.response.data.message);
                    });
            });
            
        });
	</script>
</body>
</html>